# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=libavif
pkgver=1.0.2
pkgrel=1
pkgdesc="Library for encoding and decoding .avif files"
arch=(loong64 x86_64)
url="https://github.com/AOMediaCodec/libavif"
license=(BSD)
depends=(glibc aom dav1d librav1e.so svt-av1 libpng libjpeg libyuv)
makedepends=(cmake nasm pkgconf gdk-pixbuf2)
source=(${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('de8bf79488c5b523b77358df8b85ae69c3078e6b3f1636fc1f313f952269ad20')

build() {
  cmake -B build -S ${pkgname}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DAVIF_BUILD_APPS=ON \
    -DAVIF_CODEC_AOM=ON \
    -DAVIF_CODEC_DAV1D=ON \
    -DAVIF_CODEC_RAV1E=ON \
    -DAVIF_CODEC_SVT=OFF \
    -DAVIF_BUILD_GDK_PIXBUF=ON
  make -C build
}

package() {
  make -C build DESTDIR="${pkgdir}" install
  install -Dm644 ${pkgname}-${pkgver}/LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}
